import axios from 'axios'
import http from '../http'
/**
 * 获取所有项目列表
 *
 * @returns 项目列表数据
 */
export async function getAll() {
  const req = await axios.request({
    url: '/api/projects',
    method: 'get',
  })
  return req.data
}


export async function updatePmdUser(params: any = {}) {
  const req = await http({
    method: 'PUT',
    path: '/dev-api/oa/project',
    params,
  })
  return req
}
/**
 * 获取指定项目的流程数据
 *
 * @param projectId 项目ID，默认为941
 * @returns 返回流程数据
 */
export async function getProcess(projectId: number = 941) {
  const req = await http({
    method: 'GET',
    path: `/dev-api/pms/projectDataProcess/list?projectId=${projectId}&pageSize=100`,
    params: {},
  })
  return req
}

/**
* 获取所有项目列表
*
* @returns Promise<any[]> 返回所有项目的列表
*/
export async function getProjectListAll(projectStatus = 1, pageSize = 99999) {
  const res = await http({
    method: 'GET',
    path: '/dev-api/oa/project/listall',
    params: { projectStatus, pageSize },
  })
  return res
}
/**
* 根据传入的参数获取项目列表
*
* @param params 查询参数，默认为空对象
* @returns 返回项目列表的响应数据
*/
export async function getProjectListByParams(params: any = {}) {
  const res = await http({
    method: 'GET',
    path: '/dev-api/oa/project/listall',
    params,
  })
  return res
}
/**
* 更新项目参与者
*
* @returns 返回一个 Promise 对象，表示异步操作的完成状态
*/
export async function updateProjectParticipant(params: any) {
  const res = await http({
    method: 'PUT',
    path: '/dev-api/oa/project',
    params,
  })
  return res
}

